public class Test018 {
    public static void main(String[] args) {
        int ret = facSum(5);
        System.out.println(ret);
    }
    public static int fac(int n) {
        int count=1;
        for (int i=1;i<=n;i++){
            count *=i;
        }
        return count;
    }
    public static int facSum(int x) {
        int set = 0;
        for (int i=1;i<=x;i++){
            set +=fac(i);
        }
        return set;
    }
}
